/*
 * @Descripttion:
 * @version:
 * @Author:
 * @Date: 2019-09-20 15:52:46
 */
import https from "./http";
import qs from "qs";
import {
  config
} from "./apiConfig";

// const ip = "http://11.23.254.120";
// const ip = "http://base.kingborn.org:27002";
const apiHome = {}
const apiuserNUrl = process.env.NODE_ENV == "development" ? "/userN" : `${config.ip}/auth-resource/`;
const TZD_API = process.env.NODE_ENV == "development" ? "/tzdUrl" : `${process.env.JZT_API}`;
const JZT_API = process.env.NODE_ENV == "development" ? "/jztUrl" : `${process.env.JZT_API}`;
const ZSX_API = process.env.NODE_ENV == "development" ? "/zsxUrl" : `${process.env.JZT_API}`;
const GXT_API = process.env.NODE_ENV == "development" ? "/gxtUrl" : `${process.env.JZT_API}`;

// 获取菜单栏
apiHome.getLeftMenu = function getLeftMenu(query) {
  return https({
    url: `./static/json/leftMenu.json`,
    method: 'get',
    params: query
  })
}
// 动态表单
apiHome.getdynamicFormData = function (query) {
  return https({
    url: `/static/json/dynamicForm.json`,
    method: 'get',
    params: query
  })
}
//  测试
apiHome.getmockFormData = function (query) {
  return https({
    url: `/userN/user`,
    method: 'get',
    params: query
  })
}
// // 获取用户信息
// apiHome.getUserN = function (query) {
//   return https({
//     url: `${apiuserNUrl}/user`,
//     method: 'get',
//     headers: {
//       sendKey: "getUserN"
//     },
//     params: query
//   })
// }

// 登录
apiHome.login = function (data) {
  return https({
    url: `${ZSX_API}/pwdLogin`,
    method: 'get',
    headers: {
      sendKey: "login"
    },
    params: data
  })
}
// 获取关系数据
apiHome.findCataAllRelation = function (query) {
  return https({
    url: `${GXT_API}/BusinessProcess/findCataAllRelation`,
    method: 'post',
    headers: {
      sendKey: "findCataAllRelation"
    },
    params: query
  })
}
// 获取左侧tab数据
apiHome.findBusiData = function (query) {
  return https({
    url: `${GXT_API}/BusinessProcess/findBusiData`,
    method: 'post',
    headers: {
      sendKey: "findBusiData"
    },
    params: query
  })
}
// 获取echart节点数据
apiHome.findCataAll = function (query) {
  return https({
    url: `${GXT_API}/BusinessProcess/findCataAll`,
    method: 'post',
    headers: {
      sendKey: "findCataAll"
    },
    params: query
  })
}
export default apiHome;
